package edu.colorado.cs.correll.cudroplet.shaperecognition;

import java.util.HashSet;

import processing.core.PApplet;

public class SimpleSwarm extends Swarm {



	@SuppressWarnings("unchecked")
	public SimpleSwarm(ShapeRecognition shapeRecognition, 
			SimpleEnvironmentMap simpleEnvMap) {
		this.shapeRecognition = shapeRecognition;

		// initialize some robots
		robots = new Robot[SWARM_SIZE];
		neighbors = new HashSet[robots.length];
		
		for (int i = 0; i < robots.length; i++) {
			robots[i] = new SimpleRobot(shapeRecognition, i,
					shapeRecognition.random(simpleEnvMap.border,
							shapeRecognition.width - simpleEnvMap.border * 2),
					shapeRecognition.random(simpleEnvMap.border,
							shapeRecognition.height - simpleEnvMap.border * 2),
					shapeRecognition.random(2 * PApplet.PI));
		}
	}

	@Override
	public void update() {
		updateRobots();
		updateNeighbors();
		calcSubgraphs();
	}
}
